//
//  HardwareController.m
//  phoneTool
//
//  Created by HappyMilk 02 on 2017/8/2.
//  Copyright © 2017年 tomi. All rights reserved.
//

#import "HardwareController.h"
#import "LoginHeader.h"
#import <AVFoundation/AVFoundation.h>

@interface HardwareController ()<UITableViewDelegate,UITableViewDataSource>

@property (weak, nonatomic) IBOutlet UITableView *tabelview;

@property (nonatomic ,strong) NSArray *titleArr;
@property (nonatomic ,strong) NSArray *deteillArr;

@end

@implementation HardwareController
- (IBAction)popvc:(id)sender {
    [self.navigationController popViewControllerAnimated:YES];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    _titleArr = @[@"PhoneName",@"DeviceName",@"Version",@"PhoneModel",@"ScreenSize",@"ScreenBrightness",@"BatteryLevel"];
    NSString *screensize = [NSString stringWithFormat:@"%.f*%.f",__kwidth,__kheight];
    NSString *brightness = [NSString stringWithFormat:@"%.f",[[UIScreen mainScreen] brightness]];
    UIDevice *device = [UIDevice currentDevice];
    device.batteryMonitoringEnabled = YES;
    NSString *dianliang = [NSString stringWithFormat:@"%.f%%",[[UIDevice currentDevice] batteryLevel]*100];
    
    _deteillArr = @[[[UIDevice currentDevice] name], [[UIDevice currentDevice] systemName],[[UIDevice currentDevice] systemVersion],[[UIDevice currentDevice] model],screensize,brightness,dianliang];
    
    UIView *view=  [[UIView alloc] init];
    view.backgroundColor = [UIColor whiteColor];
    self.tabelview.tableFooterView = view;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return _titleArr.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    UITableViewCell *cell = [[UITableViewCell alloc] init];
    
    UILabel *lab = [[UILabel alloc ]initWithFrame:(CGRect){20,0,150,44}];
    lab.text = _titleArr[indexPath.row];
    [cell.contentView addSubview:lab];
    
    UILabel *lab1 = [[UILabel alloc ]initWithFrame:(CGRect){__kwidth-100,0,150,44}];
    lab1.text = _deteillArr[indexPath.row];
    [cell.contentView addSubview:lab1];
    
    return cell;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 44;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
